#pragma once
#include "ScriptComponent.hpp"
#include "GameSystem.hpp"
#include "SLB.hpp"
#include <vector>

namespace Typhoon {
	class GameWorld;
	class ScriptGameObject;
	class ScriptSystem : public GameSystem
	{
	public:
		ScriptSystem();
		~ScriptSystem();


		static ScriptSystem* System;

		static void SetWorld(GameWorld* world);
		static void InitScripting();
		
		void AddComponentFromScript(ScriptComponent* component);

		const char* get(const char* key);
		void set(const char* k, ScriptSystem* v);

		

		typedef std::vector<ScriptGameObject*> ScriptGameObjects;
		ScriptGameObjects scriptObjects;
		
		int Count();
		ScriptGameObject* GetObject(float index);
		
	protected:
		void GameObjectAdded(GameObject* gameObject);
		void GameObjectRemoved(GameObject* gameObject);

	private:
		static GameWorld* world;

		

	};
}
